<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>无标题页</title>
<link rel="stylesheet" type="text/css"
	href="../Admin/role/css/index.css">
<script type="text/javascript"
	src="../Admin/role/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">    
　　　　function cancel() {  
	      window.location.href = '../room/selectAllRoomLiu.action';
		}

</script>
</head>
<body class="mian_bj">
	<div class="mian_top_01">
		<div class="mian_top_r"></div>
		<div class="mian_top_l"></div>
		<div class="mian_top_c"></div>
		<form action="updateRoomConfirmLiu.action" method="post">
			<input type="hidden" name="id" value="${room.id}">
			<div class="mian_b">
				<table width="100%" border="0" cellpadding="20" cellspacing="0"
					class="mian_b_bg_xz">

					<tr align="center">
						<td align="center">
							<div style="padding-left: 80px">
								<table align="center" cellpadding="10">
									<tr>
										<td>&nbsp;</td>
										<td width="20%" valign="top">所属项目：</td>
										<td width="60%"><span style="color: red">*</span> <select
											name="projectid" id="projectid" class="input_01">
												<option>----------请选择所属项目--------</option>
												<c:forEach var="project" items="${projects}">
													<option value="${project.id }">${project.name}</option>
												</c:forEach>
										</select></td>
										<td width="25%">&nbsp;</td>
									</tr>
									<tr>
										<td>&nbsp;</td>
										<td width="7%" valign="top">所属楼栋：</td>
										<td width="60%"><span style="color: red">*</span> <select
											id="complexid" name="complexid" class="input_01">
												<option>----------请选择楼栋--------</option>
												<option selected="selected" ="${room.complexid }">${room.cnumber}</option>
										</select></td>
										<td width="25%">&nbsp;</td>
									</tr>
									<tr>
										<td>&nbsp;</td>
										<td width="7%" valign="top">所属单元：</td>
										<td width="60%"><span style="color: red">*</span> <select
											id="unitid" name="unitid" class="input_01">
												<option>----------请选择单元--------</option>
												<option selected="selected" value="${room.unitid }">${room.unumber}</option>
										</select></td>
										<td width="25%">&nbsp;</td>
									</tr>
									<tr>
										<td>&nbsp;</td>
										<td width="7%" valign="top">房间用途：</td>
										<td width="60%"><span style="color: red">*</span> <select
											name="purposeid" id="purposeid" class="input_01">
												<option value="">----------请选择房间用途--------</option>
												<c:forEach var="purpose" items="${purposes}">
													<option value="${purpose.id }">${purpose.name1}</option>
												</c:forEach>
										</select></td>
										<td width="25%">&nbsp;</td>
									</tr>

									<tr>
										<td>&nbsp;</td>
										<td width="15%" valign="top">房间户型：</td>
										<td width="60%"><span style="color: red">*</span> <select
											name="typeid" id="typeid" class="input_01">
												<option value="">----------请选择房间户型--------</option>
												<c:forEach var="type" items="${types}">
													<option value="${type.id }">${type.tname}</option>
												</c:forEach>
										</select></td>
										<td width="25%">&nbsp;</td>
									</tr>
								</table>
							</div>
						</td>
						<td align="center">
							<table align="left" cellpadding="5">
								<tr>
									<td>&nbsp;</td>
									<td valign="top" width="20%">房间编号：</td>
									<td><span style="color: red">*</span> <input type="text"
										class="input_01" name="number" id="number"
										value="${room.number}"></td>
									<td>&nbsp;</td>
								</tr>
								<tr>
								<tr>
									<td>&nbsp;</td>
									<td valign="top" width="7%">楼层</td>
									<td><span style="color: red">*</span> <input type="text"
										class="input_01" name=storey id="storey"
										value="${room.storey}"></td>
									<td>&nbsp;</td>
								</tr>
								<td>&nbsp;</td>
								<td valign="top" width="20%">房间面积：</td>
								<td><span style="color: red">*</span> <input type="text"
									class="input_01" name="area" id="area" value="${room.area}"></td>
								<td>&nbsp;</td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td valign="top" width="20%">房间总价：</td>
									<td><span style="color: red">*</span> <input type="text"
										class="input_01" name="roomtotal" id="roomtotal"
										value="${room.roomtotal}"></td>
									<td>&nbsp;</td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td valign="top" width="20%">房间单价：</td>
									<td><span style="color: red">*</span> <input type="text"
										class="input_01" name="roomprice" id="roomprice"
										value="${room.roomprice}"></td>
									<td>&nbsp;</td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td valign="top" width="20%">房间状态：</td>
									<td><span style="color: red">*</span> </span> <select
										name="state" id="state" class="input_01">
											<option>----------请选择状态--------</option>
											<option value="已销售" >已销售</option>
											<option value="未销售" >未销售</option>
									</select></td>
									<td>&nbsp;</td>
								</tr>

							</table>
						</td>
					</tr>
				</table>
				</br> </br>
				<div align="center">
					<input type="submit" value="确认"> <input type="button"
						value="取消" onclick="cancel()">
				</div>
				</br> </br> </br> </br> </br> </br> </br> </br> </br>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
var aaa=${room.typeid}
var bbb=${room.purposeid}
var eee=${room.projectid}
var fff="${room.state}"
$("#typeid option:eq("+aaa+")").attr("selected","selected");
$("#purposeid option:eq("+bbb+")").attr("selected","selected");
$("#projectid option:eq("+eee+")").attr("selected","selected");
$("#state  option[value="+fff+"]").attr("selected","selected");
	$(function(){
		
	/* 楼栋 */

	$("#projectid").change(
	function() {
		var projectid = $("#projectid").val();
		$.ajax({
			url : "../complex/selectComplexByProjectIdLiu.action",
			type : "POST",
			dataType : "json",
			data : {
				"projectid" : projectid
			},
		success : function(data) { 
			$('#complexid').empty();
			$('#complexid').append("<option>----------请选择楼栋--------</option>");
			jQuery.each(data.complexs, function(i,item){ 
			$('#complexid').append("<option value="+ item.id+">"+ item.cnumber+"</option>");
			  }); 
	            },
	        });;
	    });
	
	
	/*单元  */

	$("#complexid").change(			
			function() {		
			var complexid = $("#complexid").val();
			$.ajax({
			url : "../unit/selectUnitByComplexIdLiu.action",
			type : "POST",
			dataType : "json",
			data : {
				"complexid" : complexid
			},
			success : function(data) {
			$('#unitid').empty();
			$('#unitid').append("<option>----------请选择单元--------</option>");
			jQuery.each(data.units, function(i,item){ 
			$('#unitid').append("<option value="+ item.id+">"+ item.unumber+"</option>");
			  }); 
			               },
			            });
			     });
	});


</script>
</html>